home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kabc / vcardline.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.8 KB  |  116 lines

  1. /*
  2.     This file is part of libkabc.
  3.     Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public License
  16.     along with this library; see the file COPYING.LIB.  If not, write to
  17.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.     Boston, MA 02110-1301, USA.
  19. */
  20.  
  21. #ifndef VCARDLINE_H
  22. #define VCARDLINE_H
  23.  
  24. #include <qstringlist.h>
  25. #include <qvaluelist.h>
  26. #include <qvariant.h>
  27. #include <qmap.h>
  28. #include <qstring.h>
  29.  
  30. namespace KABC {
  31.  
  32. class VCardLine
  33. {
  34.   public:
  35.     typedef QValueList<VCardLine> List;
  36.     typedef QMap<QString, QStringList> ParamMap;
  37.  
  38.     VCardLine();
  39.     VCardLine( const QString &identifier );
  40.     VCardLine( const QString &identifier, const QVariant &value );
  41.     VCardLine( const VCardLine& );
  42.  
  43.     ~VCardLine();
  44.  
  45.     VCardLine& operator=( const VCardLine& );
  46.  
  47.     /**
  48.      * Sets the identifier of this line e.g. UID, FN, CLASS
  49.      */
  50.     void setIdentifier( const QString& identifier );
  51.  
  52.     /**
  53.      * Returns the identifier of this line.
  54.      */
  55.     QString identifier() const;
  56.  
  57.     /**
  58.      * Sets the value of of this line.
  59.      */
  60.     void setValue( const QVariant& value );
  61.  
  62.     /**
  63.      * Returns the value of this line.
  64.      */
  65.     QVariant value() const;
  66.  
  67.     /**
  68.      * Sets the group the line belongs to.
  69.      */
  70.     void setGroup( const QString& group );
  71.  
  72.     /**
  73.      * Returns the group the line belongs to.
  74.      */
  75.     QString group() const;
  76.  
  77.     /**
  78.      * Returns whether the line belongs to a group.
  79.      */
  80.     bool hasGroup() const;
  81.  
  82.     /**
  83.      * Returns all parameters.
  84.      */
  85.     QStringList parameterList() const;
  86.  
  87.     /**
  88.      * Add a new parameter to the line.
  89.      */
  90.     void addParameter( const QString& param, const QString& value );
  91.  
  92.     /**
  93.      * Returns the values of a special parameter.
  94.      * You can get a list of all parameters with paramList().
  95.      */
  96.     QStringList parameters( const QString& param ) const;
  97.  
  98.     /**
  99.      * Returns only the first value of a special parameter.
  100.      * You can get a list of all parameters with paramList().
  101.      */
  102.     QString parameter( const QString& param ) const;
  103.  
  104.   private:
  105.     ParamMap mParamMap;
  106.     QString mIdentifier;
  107.     QVariant mValue;
  108.  
  109.     class VCardLinePrivate;
  110.     VCardLinePrivate *d;
  111. };
  112.  
  113. }
  114.  
  115. #endif
  116.